import { Model, Unique, } from "sequelize-typescript";
import { Table, Column } from './decorate';

export enum UserStatus { 
    ACTIVE = 1,
    FORBIDDEN = -1,
    WAIT_ACTIVE = 0
}

@Table({
    underscored: true,
    underscoredAll: true,
    timestamps: true,
    paranoid: true,
    indexes: [
        {
            fields: ['username']
        },
        {
            fields: ['status']
        }
    ]
})
export default class User extends Model<User> {

    @Column
    name !: string ;
    @Unique
    @Column
    username !: string ;
    @Column
    pwd !: string ;
    @Column
    status !: UserStatus ;
 }